package com.itheima.api.client.fallback;

import com.itheima.api.client.WebUserClient;
import com.itheima.api.entity.WebUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.ArrayList;
import java.util.List;

@Slf4j
public class WebClientFallbackFactory implements FallbackFactory<WebUserClient> {
    @Override
    public WebUserClient create(Throwable cause) {
        log.error("调用blog-auth异常：{}", cause.getMessage());
        return new WebUserClient() {
            @Override
            public List<WebUser> findUserList(Iterable<Integer> userIds) {
                return new ArrayList<>(0);
            }

            @Override
            public List<Integer> findUserIdListByNickName(String nickName) {
                return new ArrayList<>(0);
            }
        };
    }
}
